<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>用户管理</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>

<ui:param name="bean" value="#{roleManagerAction}" />
<h:body>
	<p:outputLabel value="查询角色："></p:outputLabel>
	<br />
	<h:form id="fadd">
		<p:dataTable var="role" value="#{bean.role}">
			<p:column width="10%"/>
			<p:column headerText="标识" style="text-align:center" width="15%">
				<p:inputText size="12" maxlength="16"   value="#{role.id}"/>
			</p:column>
			<p:column headerText="角色名" style="text-align:center" width="15%">
				<p:inputText size="12" maxlength="32"   value="#{role.name}"/>
			</p:column>		
			<p:column headerText="描述" style="text-align:center" width="36%">
				<p:inputText size="24" maxlength="64"  value="#{role.description}"/>
			</p:column>
			<p:column headerText="操作" style="text-align:center" width="14%">
				<p:commandButton value="查询" action="#{bean.search}" update=":flist:dlist" ajax="true"></p:commandButton>
			</p:column>
			<p:column width="10%"/>
		</p:dataTable>
	</h:form>
	<br />

	<!-- 展示查询结果数据 -->
	<p:outputLabel value="查询结果："></p:outputLabel>
	<br />
	<h:form id="flist">
		<p:messages id="messages" showDetail="true" life="3000"/>	
		<p:dataTable id="dlist" var="role" value="#{bean.roleList}"	resizableColumns="true" paginator="true" rows="15">
			<p:column width="5%"/>
			<p:column headerText="标识" style="text-align:center" width="10%">
				<h:outputText value="#{role.id}" readonly="true" styleClass="text-align:center"/>
			</p:column>			
			<p:column headerText="角色名" style="text-align:center" width="15%">
				<p:inputText size="16" maxlength="64"   value="#{role.name}" />
			</p:column>
			<p:column headerText="描述" style="text-align:center" width="40%">
				<p:inputText size="32" maxlength="64"    value="#{role.description}"/>
			</p:column>		
			<p:column headerText="操作" style="text-align:center" width="15%">
				<p:commandButton value="修改" action="#{bean.modify(role)}"		update="dlist" ajax="true"/>
				<p:commandButton value="删除" action="#{bean.delete(role.id)}"	update="dlist" ajax="true">
					<p:confirm header="确认框" message="确定删除角色?" icon="ui-icon-alert" />
				</p:commandButton>
				<center>
					<p:confirmDialog global="true" showEffect="fade"
						hideEffect="explode" style="text-align:center">
						<p:commandButton value="确定" type="button"
							styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
						<p:commandButton value="取消" type="button"
							styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
					</p:confirmDialog>
				</center>
			</p:column>	
			<p:column width="5%"/>		
		</p:dataTable>
	</h:form>
</h:body>
</html>